import request from "@/utils/request";
import qs from "qs";

// 读取网站下的栏目列表
export function getChannelListForTree(data) {
  return request({
    url: "/channel/getChannelListForTree",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "post",
    data: qs.stringify(data),
  });
}

// 读取网站下的栏目列表  一稿多投用
export function getChannelListForYigaoduotou(data) {
  return request({
    url: "/duplicateSubmission/channel/list",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "post",
    data: qs.stringify(data),
  });
}

// 2.读取栏目详细信息
export function getChannelDetails(channelId) {
  return request({
    url: "/channel/" + channelId,
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "get",
  });
}

// 18、读取栏目参数
export function getChannelProp(params) {
  return request({
    url: "/channel/getChannelProp",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "POST",
    params: params,
  });
}

// 读取文章列表模板  4
export function getChannelListTemplate(channelId) {
  return request({
    url: "/channel/listTemplate/" + channelId,
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "get",
  });
}

// 读取附加文章列表模板  5
export function getChannelListAppendList(channelId) {
  return request({
    url: "/channel/appendListT/" + channelId,
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "get",
  });
}

// 查询共享栏目列表  5
export function getShareViewChannel(params) {
  return request({
    url: "/channel/viewShareChannel",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "get",
    params: params,
  });
}

// 读取附加文章模板详情  5
export function getChannelAppendDetails(channelId) {
  return request({
    url: "/channel/getTemplate/" + channelId,
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "POST",
  });
}

// 删除附加文章列表模板  5
export function removeTemplate(data) {
  return request({
    url: "/channel/removeTemplate",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "POST",
    data: qs.stringify(data),
  });
}

// 新增栏目
export function channelAdd(data) {
  return request({
    url: "/channel/addChannel",
    method: "POST",
    data: data,
  });
}

// 删除栏目
export function channelRemove(data) {
  return request({
    url: "/channel/remove",
    headers: {
      "content-type": "application/x-www-form-urlencoded",
      showLoading: true,
    },
    method: "POST",
    data: qs.stringify(data),
  });
}

// 修改栏目
export function channelEdit(data) {
  return request({
    url: "/channel/editChannel",
    method: "POST",
    data: data,
  });
}

//新增附加列表模板
export function addTemplate(data) {
  return request({
    url: "/channel/addTemplate",
    method: "post",
    data: data,
  });
}

//更新附加列表模板
export function editTemplate(data) {
  return request({
    url: "/channel/editTemplate",
    method: "post",
    data: data,
  });
}

//验证附加列表模板名称是否在栏目下已存在    true存在|false不存在
export function repeatName(data) {
  return request({
    url: "/channel/existAppendListName",
    method: "post",
    headers: {
      "content-type": "application/x-www-form-urlencoded",
      showLoading: false,
    },
    data: qs.stringify(data),
  });
}

//栏目发布
export function publicChannel(data) {
  return request({
    url: "/release/publicize/channel",
    headers: {
      "content-type": "application/x-www-form-urlencoded",
      showLoading: false,
    },
    method: "post",
    timeout: 0,
    data: qs.stringify(data),
  });
}
//  04、查询发布任务进度
export function publicize(data) {
  return request({
    url: "/release/publicize/task/info",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "post",
    data: qs.stringify(data),
  });
}
//  05、获取发布历史记录列表
export function publicizeList(data) {
  return request({
    url: "/release/publicize/history/list",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "post",
    data: qs.stringify(data),
  });
}

//08、生成网站浏览地址
export function makeSiteViewUrl(data) {
  return request({
    url: "/useful/makeSiteViewUrl",
    headers: {
      "content-type": "application/x-www-form-urlencoded",
      showLoading: false,
    },
    method: "post",
    data: qs.stringify(data),
  });
}
//07、生成栏目浏览地址
export function makeChannelViewUrl(data) {
  return request({
    url: "/useful/makeChannelViewUrl",
    headers: {
      "content-type": "application/x-www-form-urlencoded",
      showLoading: false,
    },
    method: "post",
    data: qs.stringify(data),
  });
}

//  19、删除流程定义人员
export function moveUserFormWF(data) {
  return request({
    url: "/channel/moveUserFormWF",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "post",
    data: qs.stringify(data),
  });
}

//  01、栏目导出
export function exportChannel(data) {
  return request({
    url: "/inputAndOutput/export/channel",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "post",
    data: qs.stringify(data),
  });
}

//  03、整站导出
export function exportSite(data) {
  return request({
    url: "/inputAndOutput/export/site",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "post",
    data: qs.stringify(data),
  });
}

//  21、栏目复制
export function channelCopy(data) {
  return request({
    url: "/channel/copy",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "post",
    data: qs.stringify(data),
  });
}
//  20、栏目移动
export function channelMove(data) {
  return request({
    url: "/channel/move",
    headers: { "content-type": "application/x-www-form-urlencoded" },
    method: "post",
    data: qs.stringify(data),
  });
}
